﻿// //  ********************************************************************************
// //  Copyright (C) 2016 Sebastian Kenter. All rights reserved.
// // 
// //  Name    : PhotonServerProject | PhotonServerFramework | IClientPeerRegistry.cs
// //  Created : 2016 - 03 - 21 09:55
// //  Modified: 2016 - 04 - 18 09:38
// //  ********************************************************************************

using System;
using System.Collections.Generic;
using ExitGames.Logging;

namespace PhotonServerFramework.Interfaces.Client
{
    /// <summary>
    ///     Interface for the client peer registry managing clients internally per server application
    /// </summary>
    public interface IClientPeerRegistry
    {
        /// <summary>
        ///     Logger instance
        /// </summary>
        ILogger Logger { get; }

        /// <summary>
        ///     Registers a new client peer with the server application
        /// </summary>
        /// <param name="clientPeer">The client peer to be registered</param>
        /// <returns>true if registered, otherwise false</returns>
        bool RegisterClientPeer(IClientPeer clientPeer);

        /// <summary>
        ///     Unregisters an existing client peer from the server application
        /// </summary>
        /// <param name="clientPeerId">The id of the client peer to be unregistered</param>
        /// <returns>true if unregistered, otherwise false</returns>
        bool UnregisterClientPeer(Guid clientPeerId);

        /// <summary>
        ///     Gets a specific client peer from the registry identified by it's unique id
        /// </summary>
        /// <param name="clientPeerId">The id of the client peer to be retrieved</param>
        /// <returns>The client peer if found, otherwise null</returns>
        IClientPeer GetClientPeerById(Guid clientPeerId);

        /// <summary>
        ///     Gets a dictionary of all current registered client peers
        /// </summary>
        /// <returns>Dictionary of registered client peers (can be null!)</returns>
        Dictionary<Guid, IClientPeer> GetClientPeers();

        /// <summary>
        ///     Disconnect all clients connected to the server with the given serverId
        /// </summary>
        /// <param name="serverId">The id of the requesting server</param>
        void UnregisterClientPeers(Guid serverId);
    }
}
